<?php
namespace Rcard\Controller;

use Think\Controller;
use Think\Hook;

class IndexController extends BaseController
{

    public function index()
    {
        $this->setTitle(L('_THE_SECRET_'));
        $this->setKeywords(L('_THE_SECRET_'));
        $this->display();
    }

    public function excharge(){
        if(!is_login()){
            $this->error(L('_PLEASE_MAKE_A_CHANGE_'));
        }
        $cdk=$_POST['cdkey'];
        $rs=D('Rcard')->exchargeRcard($cdk);
        if($rs['status']==1){
            $this->success($rs['info']);
        }else{
            $this->error($rs['info']);
        }
    }

    public function record(){
        $list=D('RcardRecord')->order('create_time desc')->select();
        foreach($list as &$v){
            $v['user']=get_username($v['uid']);
        }

        //dump($list);exit;
        $this->assign('list',$list);
        $this->display();
    }









}